package com.example.barcodeapp.ui.own.fragment;

import android.content.Intent;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.adapter.AdapterXilei3;
import com.example.barcodeapp.adapter.ownadapter.AdapterXilei;
import com.example.barcodeapp.base.BaseFragment;
import com.example.barcodeapp.common.Constants;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.persenter.own.OnePresenter;
import com.example.barcodeapp.ui.own.activity.XiangQingActivity;
import com.example.barcodeapp.ui.own.bean.KeChengBean;

import butterknife.BindView;


public class FragmentZhiBo extends BaseFragment <IOwn.Persenter2> implements IOwn.View2 {


    @BindView(R.id.xilei_rv)
    RecyclerView xileiRv;

    @Override
    protected int getLayout() {
        return R.layout.fragment_zhi_bo;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected OnePresenter initPersenter() {
        return new OnePresenter();
    }

    @Override
    protected void initData() {
        persenter.getXiLieKe2(Constants.lanmuid,Constants.zilanmuid,0);
    }

    @Override
    public void getXiLieKe2(KeChengBean xiLieKeBean) {
        AdapterXilei3 adapterMianFei = new AdapterXilei3(getActivity(),xiLieKeBean.getData());
        adapterMianFei.setClick(new AdapterXilei3.IClick() {
            @Override
            public void click(int pos) {
                //详情界面
                Intent instant = new Intent(getActivity(), XiangQingActivity.class);
                instant.putExtra("data","直播课");
                startActivity(instant);
            }
        });
        xileiRv.setLayoutManager(new LinearLayoutManager(getActivity()));
        xileiRv.setAdapter(adapterMianFei);
        adapterMianFei.notifyDataSetChanged();
    }
}